package models

import "gorm.io/gorm"

type Guang struct {
	gorm.Model
	Name     string `gorm:"varchar(100);not null" json:"name"`
	Zhong    string `gorm:"varchar(100);not null" json:"zhong"`
	Address  string `gorm:"varchar(100);not null" json:"address"`
	Datetime string `gorm:"varchar(100);not null" json:"datetime"`
	Status   string `gorm:"enum(‘显示’,‘隐藏’)" json:"status"`
}

func (g *Guang) Add() error {
	return DB.Create(&g).Error
}
func (g *Guang) List() (guangs []Guang, err error) {
	err = DB.Debug().Find(&guangs).Error
	return guangs, err
}
func (g *Guang) Del() error {
	return DB.Delete(&g).Error
}
func (g *Guang) Update() error {
	return DB.Updates(&g).Error
}
func (g *Guang) Detail() error {
	return DB.First(&g).Error
}
